﻿using DapperExtensions;
using Nova_DAL;
using Nova_MOD;
using Nova_MOD.ResultModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nova_BLL
{
    public class TBase_StorageBll
    {
        private readonly TBase_StorageDal dal = new TBase_StorageDal();

        public TBase_Storage GetByPid(string pid)
        {
            var predicate = Predicates.Field<TBase_Storage>(t => t.PID, Operator.Eq, pid);
            return dal.GetByField(predicate);
        }

        public bool UpdateEntity(TBase_Storage entity)
        {
            return dal.Update(entity);
        }

        public bool DeleteByPid(string pid)
        {
            var predicate = Predicates.Field<TBase_Storage>(t => t.PID, Operator.Eq, pid);
            return dal.Delete(predicate);
        }

        public List<AutoOutStockModel> GetAutoOutStockList(string matCode, string serialNum)
        {
            return dal.GetAutoOutStockList(matCode,serialNum);
        }

        public int GetMetarialTypeCount(string trayId)
        {
            return dal.GetMetarialTypeCount(trayId);
        }

        public List<StorageStaticModel> GetStorageStaticList()
        {
            return dal.GetStorageStaticList();
        }

    }
}
